<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <title>打包记录 - {$tp_config.shop_info_store_name}</title>
        <link rel="stylesheet" href="__STATIC__/index/css/font.css">
        <link rel="stylesheet" href="__STATIC__/index/layui/css/layui.css?t=1527238724161">
        <link rel="stylesheet" href="__STATIC__/index/css/global.css" charset="utf-8">
    </head>
    <body>
        <include file="public/header"/>
        <div class="layui-container fly-marginTop fly-user-main">
            <include file="public/left"/>
            <div class="fly-panel fly-panel-user" pad20>
                <div class="layui-tab layui-tab-brief" lay-filter="pack">
                    <ul class="layui-tab-title">
                        <li class="" lay-id="{:url('Pack/packlist')}">面单列表</li>
                        <li class="layui-this" lay-id="{:url('Pack/packinfo',array('id'=>$info.pack_id))}">面单详情</li>
                    </ul>
                    <div class="layui-tab-content" style="padding: 20px 0;">
                          <div class="layui-form-item">
                            <label class="layui-form-label">创建时间</label>
                            <div class="layui-form-mid layui-word-aux">{$info.create_time|date='Y-m-d H:i:s',###}</div>
                          </div>
                          <div class="layui-form-item">
                            <label class="layui-form-label">面单编号</label>
                            <div class="layui-form-mid layui-word-aux">{$info.pack_number}</div>
                          </div>

                           <div class="layui-form-item">
                            <label class="layui-form-label">备注</label>
                            <div class="layui-form-mid layui-word-aux">{$info.pack_note}</div>
                          </div>
                        
  
                        <div class="site-text">
					      <p>商品信息</p>
					    </div>
                            <table class="layui-table">
                              <colgroup>
                                <col width="80">
                                <col width="150">
                                <col width="200">
                                <col width="80">
                                <col width="200">
                                <col>
                              </colgroup>
                              <thead>
                                <tr>
                                  <th>编号</th>
                                  <th>商品图片</th>
                                  <th>商品名称</th>
                                  <th>数量</th>
                                  <th>物流编号</th>
                                  <th>平台备注</th>
                                  <th>状态</th>
                                </tr> 
                              </thead>
                              <tbody>
                                <foreach name="$info.goods" item="goods">
                                <tr>
                                  <td class="layui-center">{$goods.goods_id}</td>
                                  <td><img src="{$goods.goods_origin}" width="60"></td>
                                  <td>{$goods.goods_name}</td>
                                  <td>{$goods.goods_num}</td>
                                  <td class="express_code">{$Express[$goods.express_code]}(<span>{$goods.express_number}</span>)<i class="layui-icon layui-icon-edit"></i></td>
                                  <td>{$goods.note}</td>
                                  <td>{$status[$goods.status]}</td>
                                </tr>
                                 </foreach>
                              </tbody>
                            </table>
                                      
    
                        <div style="padding: 25px">
                            <fieldset class="layui-elem-field layui-field-title">
                                <legend style="color:#FF5722;">温馨提示</legend>
                                <div class="layui-field-box" style="color: #FF5722">
                                    <p>亲爱的客户朋友们,平台签收会检查面单对应的所有商品是否到达；如果有丢包少件或者实际商品与给定商品不符，我们会第一时间联系您。</p>
                                    <p></p>
                                </div>
                            </fieldset>
                        </div>
                        
     
                    </div>
                </div>
            </div>
        </div>
        <include file="public/footer">
        <script src="__STATIC__/index/js/user.js"></script>
        <script>
        layui.define(['element','upload','form'], function(exports){

            var $ = layui.jquery;
            var upload = layui.upload;
            var form = layui.form;

            var AJAXUPLOADURL = '{:url("api/upload")}';



            form.verify({

              //我们既支持上述函数式的方式，也支持下述数组的形式
              //数组的两个值分别代表：[正则匹配、匹配不符时的提示文字]

            }); 
            //执行实例
              var uploadInst = upload.render({
                elem: '#L_upload_pdf' //绑定元素
                ,url: AJAXUPLOADURL //上传接口
                ,done: function(res){
                   if (res.status==1) {
                        $('input[name=logistics_pdf]').val(res.result.url);
                        $('#L_upload_ok').removeClass('layui-hide');
                   }
                }
                ,error: function(){
                  layui.open({
                    type:1
                    ,contet:"失败"
                  });
                }
                ,accepts: 'file'
                ,size: 500 //最大允许上传的文件大小 500kb
              });


            //添加打包商品信息 表单检测
            form.on('submit(goods)', function(data){
              $.post('packadd', data.field, function(data, textStatus, xhr) {
                 if (data.status==1) {
                    layer.msg(data.msg, {
                    icon: 1,
                    time: 2000 //2秒关闭（如果不配置，默认是3秒）
                  }, function(){
                     window.location.href = "";
                  }); 
               }else{
                layer.msg(data.msg);
                $('#verify').attr('src', VERIFYURL);
               }
               
            },'json');
              return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
              
            });

            $('.express_code').on('click', function() {
                  var obj = $(this).find('span');
                  var express_number = obj.text();
                  var goods_id = $(this).parent().find('td:eq(0)').text();
                  layer.prompt({
                    formType: 2
                    ,title: '修改物流单号'
                    ,value: express_number
                  }, function(value, index){
                    layer.close(index);
                    $.post('/Index/Index/changeTableVal', {table: 'goods',id_name:'goods_id',id_value:goods_id,field:'express_number',value:value}, function(data, textStatus, xhr) {
                         $(obj).text(value);
                         layer.msg(data.msg);
                    },'json');
       
                  });
            }); 
        });
        </script>
    </body>
</html>
